package com.baidu.controller;

import com.baidu.service.TbUserService;
import com.baidu.utils.ResultResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.baidu.pojo.TbUser;
import org.springframework.web.bind.annotation.*;
/**
 * @author 满天星斗
 * @version 1.0
 * @description: TODO
 * @date 2021/8/24 13:53
 */

@RestController
@RequestMapping("/user")
@CrossOrigin
public class TbUserController {

    @Autowired
    TbUserService userService;

    @PostMapping("/login/{userName}/{passWord}")
    public ResultResponse Login(@PathVariable String userName
                                ,@PathVariable String passWord){
        return  userService.Login(userName,passWord);
    }

    @PostMapping("/save")
    public ResultResponse saveTbUser(@RequestBody TbUser tbUser){
        userService.saveTbUser(tbUser);
        return ResultResponse.SUCCESS("注册成功");
    }

    //修改密码
    @PostMapping("/updatePwd")
    public ResultResponse updatePwd(@RequestBody TbUser tbUser){
        return userService.updatePwd(tbUser);
    }

    //发送验证码
    @PostMapping("/checkCode")
    public ResultResponse checkCode(@RequestBody TbUser tbUser){
        return userService.checkCode(tbUser);
    }




}
